#import "SplashViewController.h"
#import "ViewController.h"

@implementation SplashViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithRed:1.0 green:0.54 blue:0.40 alpha:1.0];
    
    UIImageView *logo = [[UIImageView alloc] initWithFrame:CGRectMake((self.view.bounds.size.width-120)/2, 180, 120, 120)];
    logo.image = [UIImage imageNamed:@"AppIcon"];
    logo.layer.cornerRadius = 60;
    logo.layer.masksToBounds = YES;
    [self.view addSubview:logo];
    
    UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 320, self.view.bounds.size.width, 44)];
    title.text = @"老人记忆";
    title.font = [UIFont boldSystemFontOfSize:36];
    title.textAlignment = NSTextAlignmentCenter;
    title.textColor = [UIColor whiteColor];
    [self.view addSubview:title];
    
    UILabel *slogan = [[UILabel alloc] initWithFrame:CGRectMake(0, 370, self.view.bounds.size.width, 28)];
    slogan.text = @"让记忆更温暖";
    slogan.font = [UIFont systemFontOfSize:20];
    slogan.textAlignment = NSTextAlignmentCenter;
    slogan.textColor = [UIColor colorWithWhite:1 alpha:0.9];
    [self.view addSubview:slogan];
    
    // 2秒后自动跳转到首页
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        UIWindow *window = [UIApplication sharedApplication].delegate.window;
        ViewController *vc = [[ViewController alloc] init];
        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
        window.rootViewController = nav;
    });
}

@end 
